package test;

import exthread.MyThread;

import exthread.MyThread;

public class Run {

	public static void main(String[] args) {
		try {
			MyThread thread = new MyThread();
			thread.start();
			Thread.sleep(200);
			thread.interrupt();
		} catch (InterruptedException e) {
			System.out.println("main catch");
			e.printStackTrace();
		}
		System.out.println("end!");
	}


	/**
	 * 输出结果：
	 * run begin
	   end!
	   在沉睡中被停止!进入catch!false
	   java.lang.InterruptedException: sleep interrupted
	   at java.lang.Thread.sleep(Native Method)
	   at exthread.MyThread.run(MyThread.java:9)
	 *
	 * 说明：从结果中可以看出
	 * 如果在sleep状态下停止某一线程，会进入catch语句，并且清除停止状态值，使之变成false
	 */
}
